package com.aaa.exception;

import com.aaa.entity.ResultCode;
import com.aaa.entity.ResultMsg;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

//@RestControllerAdvice
public class GlobalException {
    /*** ExceptionHandler 异常处理器 * @return */
    @ExceptionHandler(value = ArithmeticException.class)
    public ResultMsg arithmeticExceptionHandler(){
        return ResultMsg.error(500,"系统错误");
    }
    @ExceptionHandler(value = Exception.class)
    public ResultMsg exceptionHandler(){
        return ResultMsg.error(ResultCode.ERROR.getCode(),ResultCode.ERROR.getMsg());
    }
}
